<template>
  <el-button v-bind="$attrs" v-hasAuth="permission" @click="$listeners.click">
    {{ name }}
  </el-button>
</template>

<script>
const translate = (name) => {
  const map = new Map([
    ['新增', 'create'],
    ['修改', 'update'],
    ['编辑', 'update'],
    ['删除', 'delete'],
    ['复印', 'copy'],
    ['查看', 'view'],
    ['导入', 'import'],
    ['导出', 'export'],
    ['打印', 'print'],
    ['审核', 'audit'],
    ['取消审核', 'unaudit'],
    ['启用', 'enable'],
    ['禁用', 'disable'],
    ['确定', 'define'],
    ['保存', 'save'],
    ['提交', 'submit'],
    ['发布', 'publish'],
    ['撤回', 'withdraw'],
    ['预览', 'preview']
  ]);
  if (map.has(name)) {
    return map.get(name);
  }
  return name;
};
export default {
  inheritAttrs: false, // 不显示在html根元素上
  props: {
    name: {
      type: String,
      default: ''
    },
  
    permission: {
      type: String,
      default: ()=> {
        return this.$attrs.auth;
      }
    }
  },
  mounted(){
    console.log(this.$attrs);
  },
  methods: {
    handleClick(e) {
      this.$emit('click', e);
    }
  }
};
</script>

<style lang="scss" scoped></style>
